home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / gas-211 / gas / config / tc-hppa.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-30  |  13.9 KB  |  433 lines

  1. /* tc-hppa.h -- Header file for the PA */
  2.  
  3. /* Copyright (C) 1989 Free Software Foundation, Inc.
  4.  
  5. This file is part of GAS, the GNU Assembler.
  6.  
  7. GAS is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GAS is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GAS; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. /*
  23.    HP PA-RISC support was contributed by the Center for Software Science
  24.    at the University of Utah.
  25.  */
  26.  
  27. #ifndef _TC_HPPA_H
  28. #define _TC_HPPA_H
  29.  
  30. #ifndef TC_HPPA
  31. #define TC_HPPA    1
  32. #endif
  33.  
  34. #define TARGET_ARCH bfd_arch_hppa
  35. #define TARGET_FORMAT "elf-big"
  36.  
  37. #define ASEC_NULL (asection *)0
  38.  
  39. /* We can do sym1 - sym2 as long as sym2 is $global$ */
  40.  
  41. #define SEG_DIFF_ALLOWED
  42.  
  43. typedef enum FPOF { SGL, DBL, ILLEGAL_FMT, QUAD } FP_Operand_Format;
  44.  
  45. extern char *expr_end;
  46.  
  47. extern void s_globl(), s_long(), s_short(), s_space(), cons();
  48. extern void stringer();
  49. extern unsigned int next_char_of_string();
  50.  
  51. int pa_parse_number();
  52.  
  53. int pa_parse_fp_cmp_cond();
  54.  
  55. FP_Operand_Format pa_parse_fp_format();
  56.  
  57. #ifdef __STDC__
  58. int getExpression(char *str);
  59. #else
  60. int getExpression();
  61. #endif
  62.  
  63. int getAbsoluteExpression();
  64.  
  65. int evaluateAbsolute();
  66.  
  67. int pa_build_arg_reloc();
  68.  
  69. unsigned int pa_align_arg_reloc();
  70.  
  71. void pa_skip();
  72.  
  73. int pa_parse_nullif();
  74.  
  75. int pa_parse_nonneg_cmpsub_cmpltr();
  76.  
  77. int pa_parse_neg_cmpsub_cmpltr();
  78.  
  79. int pa_parse_nonneg_add_cmpltr();
  80.  
  81. int pa_parse_neg_add_cmpltr();
  82.  
  83. int  pa_build_arg_reloc();
  84.  
  85. void s_seg(), s_proc(), s_data1();
  86.  
  87. void pa_block(),    pa_call(),    pa_call_args(),    pa_callinfo();
  88. void pa_code(),        pa_comm(),    pa_copyright(),    pa_end();
  89. void pa_enter();
  90. void pa_entry(),    pa_equ(),    pa_exit(),    pa_export();
  91. void pa_export_args(),    pa_import(),    pa_label(),    pa_leave();
  92. void pa_origin(),    pa_proc(),    pa_procend(),    pa_space();
  93. void pa_spnum(),    pa_subspace(),    pa_version();
  94.  
  95. extern const pseudo_typeS md_pseudo_table[];
  96.  
  97. /*
  98.   PA-89 floating point registers are arranged like this:
  99.  
  100.  
  101.   +--------------+--------------+
  102.   |   0 or 16L   |  16 or 16R   |
  103.   +--------------+--------------+
  104.   |   1 or 17L   |  17 or 17R   |
  105.   +--------------+--------------+
  106.   |              |              |
  107.  
  108.   .              .              .
  109.   .              .              .
  110.   .              .              .
  111.  
  112.   |              |              |
  113.   +--------------+--------------+
  114.   |  14 or 30L   |  30 or 30R   |
  115.   +--------------+--------------+
  116.   |  15 or 31L   |  31 or 31R   |
  117.   +--------------+--------------+
  118.  
  119.  
  120.   The following is a version of pa_parse_number that
  121.   handles the L/R notation and returns the correct
  122.   value to put into the instruction register field.
  123.   The correct value to put into the instruction is
  124.   encoded in the structure 'pa_89_fp_reg_struct'.
  125.  
  126.  */
  127.  
  128. struct pa_89_fp_reg_struct {
  129.   char number_part;
  130.   char L_R_select;
  131. };
  132.  
  133. int need_89_opcode();
  134. int pa_89_parse_number();
  135.  
  136.  
  137. /* pa-ctrl-func.h -- Control Structures and Functions for the PA */
  138.  
  139. extern unsigned int assemble_3( /* unsigned int x; */ );
  140.  
  141. extern void dis_assemble_3( /* unsigned int x, *r; */ );
  142.  
  143. extern unsigned int assemble_12( /* unsigned int x,y; */ );
  144.  
  145. extern void dis_assemble_12( /* unsigned int as12, *x,*y */ );
  146.  
  147. extern unsigned long assemble_17( /* unsigned int x,y,z */ );
  148.  
  149. extern void dis_assemble_17( /* unsigned int as17, *x,*y,*z */ );
  150.  
  151. extern unsigned long assemble_21( /* unsigned int x; */ );
  152.  
  153. extern void dis_assemble_21( /* unsigned int as21,*x; */ );
  154.  
  155. extern unsigned long sign_ext( /* unsigned int x,len; */ );
  156.  
  157. extern void sign_unext( /* unsigned int x,len; unsigned int *result */ );
  158.  
  159. extern unsigned long low_sign_ext( /* unsigned int x,len; */ );
  160.  
  161. extern void low_sign_unext( /* unsigned int x,len; unsigned int *result */ );
  162.  
  163. struct call_desc {
  164.    unsigned int arg_reloc;
  165.    unsigned int arg_count;
  166. };
  167.  
  168. typedef struct call_desc call_descS;
  169.  
  170. extern call_descS last_call_desc;
  171.  
  172. /* GDB debug support */
  173.  
  174. #define GDB_DEBUG_SPACE_NAME "$GDB_DEBUG$"
  175. #define GDB_STRINGS_SUBSPACE_NAME "$GDB_STRINGS$"
  176. #define GDB_SYMBOLS_SUBSPACE_NAME "$GDB_SYMBOLS$"
  177.  
  178. /* pre-defined subsegments (subspaces) for the HP 9000 Series 800 */
  179.  
  180. #define SUBSEG_CODE   0
  181. #define SUBSEG_DATA   0
  182. #define SUBSEG_LIT    1
  183. #define SUBSEG_BSS    2
  184. #define SUBSEG_UNWIND 3
  185. #define SUBSEG_GDB_STRINGS 0
  186. #define SUBSEG_GDB_SYMBOLS 1
  187.  
  188. #define UNWIND_SECTION_NAME    ".hppa_unwind"
  189. /* subspace dictionary chain entry structure */
  190.  
  191. struct subspace_dictionary_chain {
  192. #if defined(OBJ_OSFROSE) | defined(OBJ_ELF)
  193. #ifdef OBJ_OSFROSE
  194.     region_command_t * ssd_entry; /* XXX: not sure this is what we need here */
  195. #else
  196.     Elf_Internal_Shdr *ssd_entry;
  197.     unsigned long    ssd_vm_addr;
  198. #endif
  199.     char * ssd_name;    /* used until time of writing object file    */
  200.                             /* then we use ssd_entry->regc_region_name    */
  201.     unsigned char ssd_quadrant;
  202.     unsigned char ssd_sort_key;
  203.     unsigned char ssd_common;
  204.     unsigned char ssd_dup_common;
  205.     unsigned char ssd_loadable;
  206.     unsigned char ssd_code_only;
  207. #else
  208.     subspace_dictS *ssd_entry;                /* this dictionary */
  209. #endif
  210.         int ssd_defined;                          /* this subspace has been used */
  211.         int ssd_space_number;                     /* space # this subspace is in */
  212.         asection * ssd_seg;                       /* this subspace =  this seg */
  213.         int ssd_subseg;                           /*                  and subseg */
  214.         int ssd_zero;
  215.         int object_file_index;                    /* index of this entry within
  216.                                                      the subspace dictionary of
  217.                                                      the object file (not used until
  218.                                                      the object file is written */
  219.         int ssd_last_align;                       /* the size of the last alignment
  220.                                                      request for this subspace */
  221.         symbolS *ssd_start_sym;                   /* a symbol whose value is the
  222.                                                      start of this subspace */
  223.         struct subspace_dictionary_chain *ssd_next; /* next subspace dict. entry */
  224. };
  225.  
  226. typedef struct subspace_dictionary_chain subspace_dict_chainS;
  227.  
  228. /* space dictionary chain entry structure */
  229.  
  230. struct space_dictionary_chain {
  231. #ifdef OBJ_OSFROSE
  232.     region_command_t * sd_entry; /* XXX: not sure this is what we need here */
  233.     char * sd_name;        /* used until time of writing object file    */
  234.                             /* then we use sd_entry->regc_region_name    */
  235.     unsigned int sd_loadable;
  236.     unsigned int sd_private;
  237.     unsigned int sd_spnum;
  238.     unsigned char sd_sort_key;
  239. #else
  240. #ifdef OBJ_ELF
  241.     Elf_Internal_Shdr *sd_entry;
  242.     char * sd_name;        /* used until time of writing object file    */
  243.                             /* then we use sd_entry->sh_name    */
  244.     unsigned int sd_loadable;
  245.     unsigned int sd_private;
  246.     unsigned int sd_spnum;
  247.     unsigned char sd_sort_key;
  248. #else
  249.         space_dictS *sd_entry;                     /* this dictionary */
  250. #endif
  251. #endif
  252.         int sd_defined;                            /* this space has been used */
  253.         asection * sd_seg;      /* GAS segment to which this space corresponds */
  254.         int sd_last_subseg;     /* current subsegment number we are using */
  255.         subspace_dict_chainS *sd_subspaces;        /* all subspaces in this space */
  256.         struct space_dictionary_chain *sd_next;    /* the next space dict. entry */
  257. };
  258.  
  259. typedef struct space_dictionary_chain space_dict_chainS; 
  260.  
  261. /*
  262.     Macros to maintain spaces and subspaces
  263.  */
  264.  
  265. #ifdef OBJ_OSFROSE
  266. #define SPACE_DEFINED(space_chain)    (space_chain)->sd_defined
  267. #define SPACE_PRIVATE(space_chain)    (space_chain)->sd_private
  268. #define SPACE_LOADABLE(space_chain)    (space_chain)->sd_loadable
  269. #define SPACE_SPNUM(space_chain)    (space_chain)->sd_spnum
  270. #define SPACE_SORT(space_chain)        (space_chain)->sd_sort_key
  271. #define SPACE_NAME(space_chain)        (space_chain)->sd_name
  272.  
  273. #define SUBSPACE_QUADRANT(ss_chain)    (ss_chain)->ssd_quadrant
  274. #define SUBSPACE_ALIGN(ss_chain)    (ss_chain)->ssd_entry->regc_addralign
  275. #define SUBSPACE_ACCESS(ss_chain)    (ss_chain)->ssd_entry->regc_initprot
  276. #define SUBSPACE_SORT(ss_chain)        (ss_chain)->ssd_sort_key
  277. #define SUBSPACE_COMMON(ss_chain)    (ss_chain)->ssd_common
  278. #define SUBSPACE_ZERO(ss_chain)        (ss_chain)->ssd_zero
  279. #define SUBSPACE_DUP_COMM(ss_chain)    (ss_chain)->ssd_dup_common
  280. #define SUBSPACE_CODE_ONLY(ssch)    ((ssch)->ssd_entry->regc_flags & REG_TEXT_T)
  281. #define SET_SUBSPACE_CODE_ONLY(ssch,val) (ssch)->ssd_entry->regc_flags |= ((val) ? REG_TEXT_T : 0)
  282. #define SUBSPACE_LOADABLE(ss_chain)    (ss_chain)->ssd_loadable
  283. #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_entry->regc_addr.vm_addr
  284. #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->regc_vm_size
  285. #define SUBSPACE_REGION_NAME(ss_chain)    (ss_chain)->ssd_entry->regc_region_name
  286. #define SUBSPACE_NAME(ss_chain)        (ss_chain)->ssd_name
  287. #endif
  288.  
  289. #ifdef OBJ_ELF
  290. #define SPACE_DEFINED(space_chain)    (space_chain)->sd_defined
  291. #define SPACE_PRIVATE(space_chain)    (space_chain)->sd_private
  292. #define SPACE_LOADABLE(space_chain)    (space_chain)->sd_loadable
  293. #define SPACE_SPNUM(space_chain)    (space_chain)->sd_spnum
  294. #define SPACE_SORT(space_chain)        (space_chain)->sd_sort_key
  295. #define SPACE_NAME(space_chain)        (space_chain)->sd_name
  296.  
  297. #define SUBSPACE_QUADRANT(ss_chain)    (ss_chain)->ssd_quadrant
  298. #define SUBSPACE_ALIGN(ss_chain)    (ss_chain)->ssd_entry->sh_addralign
  299. #define SUBSPACE_ACCESS(ss_chain)    (ss_chain)->ssd_entry->sh_flags
  300. #define SUBSPACE_SORT(ss_chain)        (ss_chain)->ssd_sort_key
  301. #define SUBSPACE_COMMON(ss_chain)    (ss_chain)->ssd_common
  302. #define SUBSPACE_ZERO(ss_chain)        (ss_chain)->ssd_zero
  303. #define SUBSPACE_DUP_COMM(ss_chain)    (ss_chain)->ssd_dup_common
  304. #define SUBSPACE_CODE_ONLY(ssch) \
  305.     (((ssch)->ssd_entry->sh_flags & (SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE)) \
  306.      == (SHF_ALLOC | SHF_EXECINSTR))
  307. #define SET_SUBSPACE_CODE_ONLY(ssch,val) \
  308.         (ssch)->ssd_entry->sh_flags &= ((val) ? ~SHF_WRITE : 0xffffffff)
  309. #define SUBSPACE_LOADABLE(ss_chain)    (ss_chain)->ssd_loadable
  310. #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_vm_addr
  311. #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->sh_size
  312. #define SUBSPACE_NAME(ss_chain)        (ss_chain)->ssd_name
  313. #endif
  314.  
  315. #ifdef OBJ_SOM
  316. #define SPACE_DEFINED(space_chain)    (space_chain)->sd_entry->is_defined
  317. #define SPACE_PRIVATE(space_chain)    (space_chain)->sd_entry->is_private
  318. #define SPACE_LOADABLE(space_chain)    (space_chain)->sd_entry->is_loadable
  319. #define SPACE_SPNUM(space_chain)    (space_chain)->sd_entry->space_number
  320. #define SPACE_SORT(space_chain)        (space_chain)->sd_entry->sort_key
  321. #define SPACE_NAME(space_chain)        (space_chain)->sd_entry->name
  322.  
  323. #define SUBSPACE_QUADRANT(ss_chain)    (ss_chain)->ssd_entry->quadrant
  324. #define SUBSPACE_ALIGN(ss_chain)    (ss_chain)->ssd_entry->alignment
  325. #define SUBSPACE_ACCESS(ss_chain)    (ss_chain)->ssd_entry->access_control_bits
  326. #define SUBSPACE_SORT(ss_chain)        (ss_chain)->ssd_entry->sort_key
  327. #define SUBSPACE_COMMON(ss_chain)    (ss_chain)->ssd_entry->is_common
  328. #define SUBSPACE_ZERO(ss_chain)        (ss_chain)->ssd_zero
  329. #define SUBSPACE_DUP_COMM(ss_chain)    (ss_chain)->ssd_entry->dup_common
  330. #define SUBSPACE_CODE_ONLY(ss_chain)    (ss_chain)->ssd_entry->code_only
  331. #define SUBSPACE_LOADABLE(ss_chain)    (ss_chain)->ssd_entry->is_loadable
  332. #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_entry->subspace_start
  333. #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->subspace_length
  334. #define SUBSPACE_NAME(ss_chain)        (ss_chain)->ssd_entry->name
  335. #endif
  336.  
  337. extern space_dict_chainS *space_dict_root;
  338. extern space_dict_chainS *space_dict_last;
  339.  
  340. extern space_dict_chainS *current_space;
  341. extern subspace_dict_chainS *current_subspace;
  342.  
  343. extern space_dict_chainS *create_new_space();
  344.  
  345. extern subspace_dict_chainS *create_new_subspace();
  346.  
  347. extern subspace_dict_chainS *update_subspace();
  348.  
  349. extern space_dict_chainS *is_defined_space();
  350.  
  351. extern space_dict_chainS *pa_segment_to_space();
  352.  
  353. extern subspace_dict_chainS *is_defined_subspace();
  354.  
  355. extern subspace_dict_chainS *pa_subsegment_to_subspace();
  356.  
  357. extern space_dict_chainS *pa_find_space_by_number();
  358.  
  359. extern unsigned int pa_subspace_start();
  360.  
  361. extern int is_last_defined_subspace();
  362.  
  363. /* symbol support */
  364.  
  365. extern symbolS * pa_get_start_symbol();
  366.  
  367. extern symbolS * pa_set_start_symbol();
  368.  
  369. /* default space and subspace dictionaries */
  370.  
  371. struct default_subspace_dict {
  372.      char *name;
  373.      char defined;
  374.      char loadable,code_only,common,dup_common,zero,sort;
  375.      int access,space_index,alignment,quadrant;
  376. #ifdef OBJ_SOM
  377.      segT segment;
  378. #else
  379.      int def_space_index;  /* this is an index in the default spaces array */
  380. #endif
  381.      subsegT subsegment;
  382.    };
  383.  
  384. extern struct default_subspace_dict pa_def_subspaces[];
  385.  
  386. struct default_space_dict {
  387.      char *name;
  388.      int spnum;
  389.      char loadable;
  390.      char defined;
  391.      char private;
  392.      char sort;
  393. #ifdef OBJ_SOM
  394.      segT segment;
  395. #else
  396.      asection * segment;
  397.      char * alias;  /* an alias for this section (or NULL if there isn't one) */
  398. #endif
  399.    };
  400.  
  401. extern struct default_space_dict pa_def_spaces[];
  402.  
  403. /*
  404.     Support for keeping track of the most recent label in each
  405.     space.
  406.  */
  407.  
  408. typedef struct label_symbol_struct {
  409.     symbolS *lss_label;            /* the label symbol        */
  410.     space_dict_chainS *lss_space;        /* the space to which it applies*/
  411.     struct label_symbol_struct *lss_next;    /* the next label symbol    */
  412. } label_symbolS;
  413.  
  414. extern label_symbolS *label_symbols_rootP;
  415.  
  416. label_symbolS *pa_get_label();
  417. int pa_label_is_defined();
  418. void pa_define_label();
  419. void pa_undefine_label();
  420. int pa_pseudo_op_moves_pc();
  421.  
  422. /* end of label symbol support. */
  423.  
  424. #define is_DP_relative(exp)  ( (exp).X_subtract_symbol        \
  425.                               && strcmp((exp).X_subtract_symbol->bsym->name,    \
  426.                                         "$global$") == 0 )
  427.  
  428. #define tc_crawl_symbol_chain(headers) {;}  /* Not used. */
  429.  
  430. #define tc_headers_hook(headers) {;}  /* Not used. */
  431.  
  432. #endif /* _TC_HPPA_H */
  433.